package service

import (
	"context"
	"guli-shopping/api-service/protobuff/OssProto"
	"guli-shopping/oss-service/utils"
	"log"
)

type OssService struct {
}



func getOssResponse() *OssProto.OssResponse {
	return &OssProto.OssResponse{}
}
func (this OssService) GetAuthUrl(ctx context.Context, request *OssProto.OssRequest) (*OssProto.OssResponse, error) {
	response := getOssResponse()
	if request.Filename=="" {
		response.Code=403
		response.Message="名称非法"
		//记录错误
		log.Println(response.Message)
		return response,nil
	}
	url := utils.GetSignedURL(request.Filename)
	response.AuthUrl=url
	response.Code=200
	response.Message="授权成功"
	return response,nil
}




